#include <iostream>
#include <signal.h>

#include <unistd.h>

void handler(int){

    std::cout << "divide zero" << std::endl;
    exit(1);
}

int main(){

    //::signal(SIGFPE,0);
    //signal()
    signal(SIGFPE, handler);
    std::cout << 0.0/0 << std::endl;
    std::cout << 1.0/0 << std::endl;
    sleep(2);
    std::cout << 0/0 <<std::endl;

    return 0;
}